/*   1:    */ package org.intellij.lang.regexp;
/*   2:    */ 
/*   3:    */

import com.intellij.lang.ParserDefinition;
import com.intellij.lexer.Lexer;
import com.intellij.openapi.editor.DefaultLanguageHighlighterColors;
import com.intellij.openapi.editor.HighlighterColors;
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.fileTypes.SyntaxHighlighterBase;
import com.intellij.openapi.project.Project;
import com.intellij.psi.StringEscapesTokenTypes;
import com.intellij.psi.TokenType;
import com.intellij.psi.tree.IElementType;
import org.jetbrains.annotations.NotNull;

import java.util.HashMap;
import java.util.Map;

/*   4:    */
/*   5:    */
/*   6:    */
/*   7:    */
/*   8:    */
/*   9:    */
/*  10:    */
/*  11:    */
/*  12:    */
/*  13:    */
/*  14:    */
/*  15:    */
/*  16:    */ 
/*  17:    */ public class RegExpHighlighter
/*  18:    */   extends SyntaxHighlighterBase
/*  19:    */ {
/*  20:    */   private static final Map<IElementType, TextAttributesKey> a;
/*  21:    */   private static final Map<IElementType, TextAttributesKey> b;
/*  22: 37 */   static final TextAttributesKey META = TextAttributesKey.createTextAttributesKey("REGEXP.META", DefaultLanguageHighlighterColors.KEYWORD);
/*  23: 41 */   static final TextAttributesKey INVALID_CHARACTER_ESCAPE = TextAttributesKey.createTextAttributesKey("REGEXP.INVALID_STRING_ESCAPE", DefaultLanguageHighlighterColors.INVALID_STRING_ESCAPE);
/*  24: 45 */   static final TextAttributesKey BAD_CHARACTER = TextAttributesKey.createTextAttributesKey("REGEXP.BAD_CHARACTER", HighlighterColors.BAD_CHARACTER);
/*  25: 49 */   static final TextAttributesKey REDUNDANT_ESCAPE = TextAttributesKey.createTextAttributesKey("REGEXP.REDUNDANT_ESCAPE", DefaultLanguageHighlighterColors.VALID_STRING_ESCAPE);
/*  26: 53 */   static final TextAttributesKey PARENTHS = TextAttributesKey.createTextAttributesKey("REGEXP.PARENTHS", DefaultLanguageHighlighterColors.PARENTHESES);
/*  27: 57 */   static final TextAttributesKey BRACES = TextAttributesKey.createTextAttributesKey("REGEXP.BRACES", DefaultLanguageHighlighterColors.BRACES);
/*  28: 61 */   static final TextAttributesKey BRACKETS = TextAttributesKey.createTextAttributesKey("REGEXP.BRACKETS", DefaultLanguageHighlighterColors.BRACKETS);
/*  29: 65 */   static final TextAttributesKey COMMA = TextAttributesKey.createTextAttributesKey("REGEXP.COMMA", DefaultLanguageHighlighterColors.COMMA);
/*  30: 69 */   static final TextAttributesKey ESC_CHARACTER = TextAttributesKey.createTextAttributesKey("REGEXP.ESC_CHARACTER", DefaultLanguageHighlighterColors.VALID_STRING_ESCAPE);
/*  31: 73 */   static final TextAttributesKey CHAR_CLASS = TextAttributesKey.createTextAttributesKey("REGEXP.CHAR_CLASS", DefaultLanguageHighlighterColors.VALID_STRING_ESCAPE);
/*  32: 77 */   static final TextAttributesKey QUOTE_CHARACTER = TextAttributesKey.createTextAttributesKey("REGEXP.QUOTE_CHARACTER", DefaultLanguageHighlighterColors.VALID_STRING_ESCAPE);
/*  33: 81 */   static final TextAttributesKey COMMENT = TextAttributesKey.createTextAttributesKey("REGEXP.COMMENT", DefaultLanguageHighlighterColors.LINE_COMMENT);
/*  34:    */   private final Project c;
/*  35:    */   private final ParserDefinition d;
/*  36:    */   
/*  37:    */   public RegExpHighlighter(Project paramProject, ParserDefinition paramParserDefinition)
/*  38:    */   {
/*  39: 90 */     this.c = paramProject;
/*  40: 91 */     this.d = paramParserDefinition;
/*  41:    */   }
/*  42:    */   
/*  43:    */   static
/*  44:    */   {
/*  45: 95 */     a = new HashMap();
/*  46: 96 */     b = new HashMap();
/*  47:    */     
/*  48: 98 */     fillMap(a, RegExpTT.KEYWORDS, META);
/*  49:    */     
/*  50:100 */     a.put(StringEscapesTokenTypes.INVALID_CHARACTER_ESCAPE_TOKEN, INVALID_CHARACTER_ESCAPE);
/*  51:101 */     a.put(StringEscapesTokenTypes.INVALID_UNICODE_ESCAPE_TOKEN, INVALID_CHARACTER_ESCAPE);
/*  52:    */     
/*  53:103 */     a.put(TokenType.BAD_CHARACTER, BAD_CHARACTER);
/*  54:104 */     a.put(RegExpTT.BAD_HEX_VALUE, INVALID_CHARACTER_ESCAPE);
/*  55:105 */     a.put(RegExpTT.BAD_OCT_VALUE, INVALID_CHARACTER_ESCAPE);
/*  56:    */     
/*  57:107 */     a.put(RegExpTT.PROPERTY, CHAR_CLASS);
/*  58:    */     
/*  59:109 */     a.put(RegExpTT.ESC_CHARACTER, ESC_CHARACTER);
/*  60:110 */     a.put(RegExpTT.UNICODE_CHAR, ESC_CHARACTER);
/*  61:111 */     a.put(RegExpTT.HEX_CHAR, ESC_CHARACTER);
/*  62:112 */     a.put(RegExpTT.OCT_CHAR, ESC_CHARACTER);
/*  63:113 */     a.put(RegExpTT.CHAR_CLASS, ESC_CHARACTER);
/*  64:114 */     a.put(RegExpTT.BOUNDARY, ESC_CHARACTER);
/*  65:115 */     a.put(RegExpTT.CTRL, ESC_CHARACTER);
/*  66:116 */     a.put(RegExpTT.ESC_CTRL_CHARACTER, ESC_CHARACTER);
/*  67:    */     
/*  68:118 */     a.put(RegExpTT.REDUNDANT_ESCAPE, REDUNDANT_ESCAPE);
/*  69:    */     
/*  70:120 */     a.put(RegExpTT.QUOTE_BEGIN, QUOTE_CHARACTER);
/*  71:121 */     a.put(RegExpTT.QUOTE_END, QUOTE_CHARACTER);
/*  72:    */     
/*  73:123 */     a.put(RegExpTT.GROUP_BEGIN, PARENTHS);
/*  74:124 */     a.put(RegExpTT.GROUP_END, PARENTHS);
/*  75:    */     
/*  76:126 */     a.put(RegExpTT.LBRACE, BRACES);
/*  77:127 */     a.put(RegExpTT.RBRACE, BRACES);
/*  78:    */     
/*  79:129 */     a.put(RegExpTT.CLASS_BEGIN, BRACKETS);
/*  80:130 */     a.put(RegExpTT.CLASS_END, BRACKETS);
/*  81:    */     
/*  82:132 */     a.put(RegExpTT.COMMA, COMMA);
/*  83:    */     
/*  84:134 */     a.put(RegExpTT.COMMENT, COMMENT);
/*  85:    */   }
/*  86:    */   
/*  87:    */   @NotNull
/*  88:    */   public Lexer getHighlightingLexer()
/*  89:    */   {
/*  90:139 */     Lexer tmp13_8 = this.d.createLexer(this.c);
/*  91:139 */     if (tmp13_8 == null) {
/*  92:139 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/intellij/lang/regexp/RegExpHighlighter", "getHighlightingLexer" }));
/*  93:    */     }
/*  94:139 */     return tmp13_8;
/*  95:    */   }
/*  96:    */   
/*  97:    */   @NotNull
/*  98:    */   public TextAttributesKey[] getTokenHighlights(IElementType paramIElementType)
/*  99:    */   {
/* 100:144 */     TextAttributesKey[] tmp27_24 = pack((TextAttributesKey)a.get(paramIElementType), (TextAttributesKey)b.get(paramIElementType));
/* 101:144 */     if (tmp27_24 == null) {
/* 102:144 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/intellij/lang/regexp/RegExpHighlighter", "getTokenHighlights" }));
/* 103:    */     }
/* 104:144 */     return tmp27_24;
/* 105:    */   }
/* 106:    */ }



/* Location:           E:\idea\

 * Qualified Name:     org.intellij.lang.regexp.RegExpHighlighter

 * JD-Core Version:    0.7.0.1

 */